﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Configuration.cs" company="ScRePt">
//   Copyright © ScRePt 2010 - 2012
// </copyright>
// <summary>
//   The configuration.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace MP3D.Configuration
{
    #region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Windows.Forms;
    using System.Xml.Serialization;

    using Helper;

    using Stereoscopic;

    #endregion

    /// <summary>
    /// The configuration.
    /// </summary>
    [Serializable]
    public class Configuration
    {
        #region Constants and Fields

        /// <summary>
        /// The latest configuration version.
        /// </summary>
        public const int LatestConfigurationVersion = 5;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Configuration"/> class.
        /// </summary>
        public Configuration()
        {
            this.FilterProperties = new SerializableDictionary<int, FilterProperty>();
            this.FilterPropertyValues = new SerializableDictionary<int, FilterPropertyValue>();
            this.MenuCommands = new SerializableDictionary<int, MenuCommand>();
            this.Menus = new SerializableDictionary<int, Menu>();
            this.Profiles = new SerializableDictionary<int, Profile>();
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets ConfigurationVersion.
        /// </summary>
        [XmlAttribute]
        public int ConfigurationVersion { get; set; }

        /// <summary>
        /// Gets or sets CurrentProfile.
        /// </summary>
        [XmlAttribute]
        public int CurrentProfile { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether DetectLetterbox.
        /// </summary>
        [XmlAttribute]
        public bool DetectLetterbox { get; set; }

        /// <summary>
        /// Gets or sets FilterProperties.
        /// </summary>
        public SerializableDictionary<int, FilterProperty> FilterProperties { get; set; }

        /// <summary>
        /// Gets or sets FilterPropertyValues.
        /// </summary>
        public SerializableDictionary<int, FilterPropertyValue> FilterPropertyValues { get; set; }

        /// <summary>
        /// Gets or sets GlobalCommands.
        /// </summary>
        public Collection<int> GlobalCommands { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether LoadAutomatically.
        /// </summary>
        [XmlAttribute]
        public bool LoadAutomatically { get; set; }

        /// <summary>
        /// Gets or sets LongPressMilliseconds.
        /// </summary>
        [XmlAttribute]
        public int LongPressMilliseconds { get; set; }

        /// <summary>
        /// Gets or sets MenuCommands.
        /// </summary>
        public SerializableDictionary<int, MenuCommand> MenuCommands { get; set; }

        /// <summary>
        /// Gets or sets Menus.
        /// </summary>
        public SerializableDictionary<int, Menu> Menus { get; set; }

        /// <summary>
        /// Gets or sets ParallaxStep.
        /// </summary>
        [XmlAttribute]
        public int ParallaxStep { get; set; }

        /// <summary>
        /// Gets or sets Profiles.
        /// </summary>
        public SerializableDictionary<int, Profile> Profiles { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether StereoscopicMenu.
        /// </summary>
        [XmlAttribute]
        public bool StereoscopicMenu { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether UpdateProfile.
        /// </summary>
        [XmlAttribute]
        public bool UpdateProfile { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether UpdateSubtitles.
        /// </summary>
        [XmlAttribute]
        public bool UpdateSubtitles { get; set; }

        #endregion

        #region Public Methods

        /// <summary>
        /// The initialize.
        /// </summary>
        public void Initialize()
        {
            this.ConfigurationVersion = LatestConfigurationVersion;

            this.FilterProperties.Clear();
            this.FilterPropertyValues.Clear();
            this.MenuCommands.Clear();
            this.Menus.Clear();

            this.InitializeFilterPropertyValues();
            this.InitializeFilterProperties();
            this.InitializeMenuCommands();
            this.InitializeMenus();
            this.InitializeProfiles();

            this.GlobalCommands = new Collection<int> { 2, 3, 4, 5 };
            this.LoadAutomatically = false;
            this.LongPressMilliseconds = 1000;
            this.UpdateProfile = true;
            this.CurrentProfile = 1;
            this.ParallaxStep = 16;
            this.UpdateSubtitles = true;
            this.DetectLetterbox = true;
            this.StereoscopicMenu = true;

            this.Compile();
        }

        /// <summary>
        /// The verify configuration.
        /// </summary>
        /// <returns>
        /// The verify configuration.
        /// </returns>
        public bool VerifyConfiguration()
        {
            if (this.FilterProperties == null || this.FilterProperties.Count == 0)
            {
                return false;
            }

            if (this.FilterPropertyValues == null || this.FilterPropertyValues.Count == 0)
            {
                return false;
            }

            if (this.MenuCommands == null || this.MenuCommands.Count == 0)
            {
                return false;
            }

            if (this.Menus == null || this.Menus.Count == 0)
            {
                return false;
            }

            if (this.Profiles == null || this.Menus.Count == 0)
            {
                return false;
            }

            if (this.ConfigurationVersion < LatestConfigurationVersion)
            {
                return false;
            }

            return true;
        }

        #endregion

        #region Methods

        /// <summary>
        /// The compile.
        /// </summary>
        private void Compile()
        {
            foreach (KeyValuePair<int, FilterProperty> pair in this.FilterProperties)
            {
                if (pair.Value is FilterPropertyEnum)
                {
                    FilterPropertyEnum propertyEnum = (FilterPropertyEnum)pair.Value;
                    propertyEnum.StereoscopicValueToFilterPropertyValueIds.Clear();

                    foreach (int i in propertyEnum.FilterPropertyValueIds)
                    {
                        // let it crash if i not found cause settings are wrong!!
                        int stereoscopicValue = this.FilterPropertyValues[i].Value;

                        if (!propertyEnum.StereoscopicValueToFilterPropertyValueIds.ContainsKey(stereoscopicValue))
                        {
                            propertyEnum.StereoscopicValueToFilterPropertyValueIds.Add(stereoscopicValue, i);
                        }
                    }
                }
            }

            foreach (KeyValuePair<int, Menu> pair in this.Menus)
            {
                pair.Value.InitialOptionValues.Clear();
                pair.Value.InitialOptionPropertyId = -1;

                if (pair.Value.InitialOptionType == MP3D.Configuration.Menu.MenuInitialOptionTypes.FromFilterProperty)
                {
                    foreach (int i in pair.Value.MenuCommandIds)
                    {
                        pair.Value.InitialOptionPropertyId = this.CompileMenuInitialOptionPerCommand(i, pair.Value.InitialOptionValues, pair.Value.InitialOptionPropertyId, -1);
                    }
                }
            }
        }

        /// <summary>
        /// The compile menu initial option per command.
        /// </summary>
        /// <param name="commandId">
        /// The command id.
        /// </param>
        /// <param name="initialOptionValues">
        /// The initial option values.
        /// </param>
        /// <param name="initialOptionPropertyId">
        /// The initial option property id.
        /// </param>
        /// <param name="commandIdToSave">
        /// The command id to save.
        /// </param>
        /// <returns>
        /// The compile menu initial option per command.
        /// </returns>
        private int CompileMenuInitialOptionPerCommand(int commandId, IDictionary<int, int> initialOptionValues, int initialOptionPropertyId, int commandIdToSave)
        {
            if (this.MenuCommands[commandId] is MenuCommandPropertySet)
            {
                MenuCommandPropertySet command = (MenuCommandPropertySet)this.MenuCommands[commandId];

                if (initialOptionPropertyId < 0)
                {
                    initialOptionPropertyId = command.PropertyId;
                }
                else if (initialOptionPropertyId != command.PropertyId)
                {
                    return initialOptionPropertyId;
                }

                int stereoValue = this.FilterPropertyValues[command.Value].Value;

                if (!initialOptionValues.ContainsKey(stereoValue))
                {
                    initialOptionValues.Add(stereoValue, commandIdToSave == -1 ? commandId : commandIdToSave);
                }
            }
            else if (this.MenuCommands[commandId] is MenuCommandGoTo)
            {
                MenuCommandGoTo command = (MenuCommandGoTo)this.MenuCommands[commandId];
                initialOptionPropertyId = this.CompileMenuInitialOptions(command.MenuId, initialOptionValues, initialOptionPropertyId, commandIdToSave == -1 ? commandId : commandIdToSave);
            }

            return initialOptionPropertyId;
        }

        /// <summary>
        /// The compile menu initial options.
        /// </summary>
        /// <param name="menuId">
        /// The menu id.
        /// </param>
        /// <param name="initialOptionValues">
        /// The initial option values.
        /// </param>
        /// <param name="initialOptionPropertyId">
        /// The initial option property id.
        /// </param>
        /// <param name="commandIdToSave">
        /// The command id to save.
        /// </param>
        /// <returns>
        /// The compile menu initial options.
        /// </returns>
        private int CompileMenuInitialOptions(int menuId, IDictionary<int, int> initialOptionValues, int initialOptionPropertyId, int commandIdToSave)
        {
            Menu menu = this.Menus[menuId];

            if (menu.InitialOptionType == MP3D.Configuration.Menu.MenuInitialOptionTypes.FromFilterProperty)
            {
                foreach (int i in menu.MenuCommandIds)
                {
                    initialOptionPropertyId = this.CompileMenuInitialOptionPerCommand(i, initialOptionValues, initialOptionPropertyId, commandIdToSave);
                }
            }

            return initialOptionPropertyId;
        }

        /// <summary>
        /// The initialize filter properties.
        /// </summary>
        private void InitializeFilterProperties()
        {
            // Source format property
            Collection<int> propertyValues = new Collection<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
            this.FilterProperties.Add(1, new FilterPropertyEnum { Id = 1, Name = "SourceFormat", Supported = true, PropertyType = FilterProperty.FilterPropertyTypes.Enumeration, StereoscopicFilterPropertyId = TSTFConfig.PROP_LAYOUT, FilterPropertyValueIds = propertyValues });

            // Output format property
            propertyValues = new Collection<int> { 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154 };
            this.FilterProperties.Add(2, new FilterPropertyEnum { Id = 2, Name = "OutputFormat", Supported = true, PropertyType = FilterProperty.FilterPropertyTypes.Enumeration, StereoscopicFilterPropertyId = TSTFConfig.PROP_METHOD, FilterPropertyValueIds = propertyValues });

            // Parallax properties
            this.FilterProperties.Add(3, new FilterProperty { Id = 3, Name = "ParallaxHorizontically", Supported = true, PropertyType = FilterProperty.FilterPropertyTypes.Integer, StereoscopicFilterPropertyId = TSTFConfig.PROP_ADJUSTHORIZONTALLY });
            this.FilterProperties.Add(4, new FilterProperty { Id = 4, Name = "ParallaxVertically", Supported = true, PropertyType = FilterProperty.FilterPropertyTypes.Integer, StereoscopicFilterPropertyId = TSTFConfig.PROP_ADJUSTVERTICALLY });
        }

        /// <summary>
        /// The initialize filter property values.
        /// </summary>
        private void InitializeFilterPropertyValues()
        {
            // Source values
            this.FilterPropertyValues.Add(1, new FilterPropertyValueEnum { Id = 1, Supported = true, Enabled = true, Name = "Monoscopic", Value = TSTFConfig.LAYOUT_MONOSCOPIC, NextPropertyValueId = 2, PrevPropertyValueId = 14 });
            this.FilterPropertyValues.Add(2, new FilterPropertyValueEnum { Id = 2, Supported = true, Enabled = true, Name = "InterlacedRF", Value = TSTFConfig.LAYOUT_INTERLEAVED1, NextPropertyValueId = 3, PrevPropertyValueId = 1 });
            this.FilterPropertyValues.Add(3, new FilterPropertyValueEnum { Id = 3, Supported = true, Enabled = true, Name = "InterlacedLF", Value = TSTFConfig.LAYOUT_INTERLEAVED2, NextPropertyValueId = 4, PrevPropertyValueId = 2 });
            this.FilterPropertyValues.Add(4, new FilterPropertyValueEnum { Id = 4, Supported = true, Enabled = true, Name = "SideBySideRF", Value = TSTFConfig.LAYOUT_SIDEBYSIDE1, NextPropertyValueId = 5, PrevPropertyValueId = 3 });
            this.FilterPropertyValues.Add(5, new FilterPropertyValueEnum { Id = 5, Supported = true, Enabled = true, Name = "SideBySideLF", Value = TSTFConfig.LAYOUT_SIDEBYSIDE2, NextPropertyValueId = 6, PrevPropertyValueId = 4 });
            this.FilterPropertyValues.Add(6, new FilterPropertyValueEnum { Id = 6, Supported = true, Enabled = true, Name = "OverUnderRT", Value = TSTFConfig.LAYOUT_OVERUNDER1, NextPropertyValueId = 7, PrevPropertyValueId = 5 });
            this.FilterPropertyValues.Add(7, new FilterPropertyValueEnum { Id = 7, Supported = true, Enabled = true, Name = "OverUnderLT", Value = TSTFConfig.LAYOUT_OVERUNDER2, NextPropertyValueId = 11, PrevPropertyValueId = 6 });
            this.FilterPropertyValues.Add(8, new FilterPropertyValueEnum { Id = 8, Supported = false, Enabled = false, Name = "DualInput", Value = TSTFConfig.LAYOUT_DUALSTREAM });
            this.FilterPropertyValues.Add(9, new FilterPropertyValueEnum { Id = 9, Supported = false, Enabled = false, Name = "2DDepth", Value = TSTFConfig.LAYOUT_2DDEPTH });
            this.FilterPropertyValues.Add(10, new FilterPropertyValueEnum { Id = 10, Supported = false, Enabled = false, Name = "Depth2D", Value = TSTFConfig.LAYOUT_DEPTH2D });
            this.FilterPropertyValues.Add(11, new FilterPropertyValueEnum { Id = 11, Supported = true, Enabled = true, Name = "MultiViewTiled", Value = TSTFConfig.LAYOUT_TILED, NextPropertyValueId = 12, PrevPropertyValueId = 7 });
            this.FilterPropertyValues.Add(12, new FilterPropertyValueEnum { Id = 12, Supported = true, Enabled = true, Name = "MultiViewTiledReversed", Value = TSTFConfig.LAYOUT_TILEDREVERSED, NextPropertyValueId = 13, PrevPropertyValueId = 11 });
            this.FilterPropertyValues.Add(13, new FilterPropertyValueEnum { Id = 13, Supported = true, Enabled = true, Name = "FrameSequentialRF", Value = TSTFConfig.LAYOUT_FRAMESEQENTIALRF, NextPropertyValueId = 14, PrevPropertyValueId = 12 });
            this.FilterPropertyValues.Add(14, new FilterPropertyValueEnum { Id = 14, Supported = true, Enabled = true, Name = "FrameSequentialLF", Value = TSTFConfig.LAYOUT_FRAMESEQENTIALLF, NextPropertyValueId = 1, PrevPropertyValueId = 13 });

            // Output values
            this.FilterPropertyValues.Add(101, new FilterPropertyValueEnum { Id = 101, Supported = true, Enabled = true, Name = "Source", Value = CONSTS.METHOD_SOURCE, NextPropertyValueId = 102, PrevPropertyValueId = 151 });
            this.FilterPropertyValues.Add(102, new FilterPropertyValueEnum { Id = 102, Supported = true, Enabled = true, Name = "MonoL", Value = CONSTS.METHOD_MONOSCOPIC1, NextPropertyValueId = 103, PrevPropertyValueId = 101 });
            this.FilterPropertyValues.Add(103, new FilterPropertyValueEnum { Id = 103, Supported = true, Enabled = true, Name = "MonoR", Value = CONSTS.METHOD_MONOSCOPIC2, NextPropertyValueId = 152, PrevPropertyValueId = 102 });
#if SPECIAL && DUALOUTPUT
            this.FilterPropertyValue.Add(104, new FilterPropertyValueEnum { Id = 104, Supported = true, Enabled = true, Name = "Dual", Value = CONSTS.METHOD_DUALOUTPUT, NextPropertyValueId = 114, PrevPropertyValueId = 153 });
#else
            this.FilterPropertyValues.Add(104, new FilterPropertyValueEnum { Id = 104, Supported = false, Enabled = false, Name = "Dual", Value = CONSTS.METHOD_DUALOUTPUT });
#endif
            this.FilterPropertyValues.Add(105, new FilterPropertyValueEnum { Id = 105, Supported = false, Enabled = false, Name = "DualStereoBright", Value = CONSTS.METHOD_STEREOBRIGHT });
#if SPECIAL && NVIDIA
            this.FilterPropertyValue.Add(106, new FilterPropertyValueEnum { Id = 106, Supported = true, Enabled = true, Name = "NVIDIA", Value = CONSTS.METHOD_NVIDIA, NextPropertyValueId = 114, PrevPropertyValueId = 153 });
#else
            this.FilterPropertyValues.Add(106, new FilterPropertyValueEnum { Id = 106, Supported = false, Enabled = false, Name = "NVIDIA", Value = CONSTS.METHOD_NVIDIA });
#endif
            this.FilterPropertyValues.Add(107, new FilterPropertyValueEnum { Id = 107, Supported = false, Enabled = false, Name = "OPENGL", Value = CONSTS.METHOD_OPENGL });
            this.FilterPropertyValues.Add(108, new FilterPropertyValueEnum { Id = 108, Supported = false, Enabled = false, Name = "SoftPageFlip", Value = CONSTS.METHOD_SOFTPAGEFLIP });
            this.FilterPropertyValues.Add(109, new FilterPropertyValueEnum { Id = 109, Supported = false, Enabled = false, Name = "Sharp", Value = CONSTS.METHOD_SHARP });
            this.FilterPropertyValues.Add(110, new FilterPropertyValueEnum { Id = 110, Supported = false, Enabled = false, Name = "TridelitySL", Value = CONSTS.METHOD_TRIDELITY });
            this.FilterPropertyValues.Add(111, new FilterPropertyValueEnum { Id = 111, Supported = false, Enabled = false, Name = "Iz3D2007", Value = CONSTS.METHOD_IZ3D07GLASSES });
            this.FilterPropertyValues.Add(112, new FilterPropertyValueEnum { Id = 112, Supported = false, Enabled = false, Name = "Iz3D2009", Value = CONSTS.METHOD_IZ3D09GLASSES });
            this.FilterPropertyValues.Add(113, new FilterPropertyValueEnum { Id = 113, Supported = false, Enabled = false, Name = "SIS", Value = CONSTS.METHOD_SIS });
            this.FilterPropertyValues.Add(114, new FilterPropertyValueEnum { Id = 114, Supported = true, Enabled = true, Name = "SideBySideRF", Value = CONSTS.METHOD_SIDEBYSIDE1, NextPropertyValueId = 115, PrevPropertyValueId = 153 });
            this.FilterPropertyValues.Add(115, new FilterPropertyValueEnum { Id = 115, Supported = true, Enabled = true, Name = "SideBySideLF", Value = CONSTS.METHOD_SIDEBYSIDE2, NextPropertyValueId = 116, PrevPropertyValueId = 114 });
            this.FilterPropertyValues.Add(116, new FilterPropertyValueEnum { Id = 116, Supported = true, Enabled = true, Name = "OverUnderRT", Value = CONSTS.METHOD_OVERUNDER1, NextPropertyValueId = 117, PrevPropertyValueId = 115 });
            this.FilterPropertyValues.Add(117, new FilterPropertyValueEnum { Id = 117, Supported = true, Enabled = true, Name = "OverUnderLT", Value = CONSTS.METHOD_OVERUNDER2, NextPropertyValueId = 118, PrevPropertyValueId = 116 });
            this.FilterPropertyValues.Add(118, new FilterPropertyValueEnum { Id = 118, Supported = true, Enabled = true, Name = "InterlacedRT", Value = CONSTS.METHOD_INTERLEAVED1, NextPropertyValueId = 119, PrevPropertyValueId = 117 });
            this.FilterPropertyValues.Add(119, new FilterPropertyValueEnum { Id = 119, Supported = true, Enabled = true, Name = "InterlacedLT", Value = CONSTS.METHOD_INTERLEAVED2, NextPropertyValueId = 120, PrevPropertyValueId = 118 });
            this.FilterPropertyValues.Add(120, new FilterPropertyValueEnum { Id = 120, Supported = true, Enabled = true, Name = "InterlacedRF", Value = CONSTS.METHOD_INTERLEAVED3, NextPropertyValueId = 121, PrevPropertyValueId = 119 });
            this.FilterPropertyValues.Add(121, new FilterPropertyValueEnum { Id = 121, Supported = true, Enabled = true, Name = "InterlacedLF", Value = CONSTS.METHOD_INTERLEAVED4, NextPropertyValueId = 124, PrevPropertyValueId = 120 });
            this.FilterPropertyValues.Add(122, new FilterPropertyValueEnum { Id = 122, Supported = false, Enabled = false, Name = "CheckerBoardRF", Value = CONSTS.METHOD_CHECKERBOARD1 });
            this.FilterPropertyValues.Add(123, new FilterPropertyValueEnum { Id = 123, Supported = false, Enabled = false, Name = "CheckerBoardLF", Value = CONSTS.METHOD_CHECKERBOARD2 });
            this.FilterPropertyValues.Add(124, new FilterPropertyValueEnum { Id = 124, Supported = true, Enabled = true, Name = "TrueAnaRB", Value = CONSTS.METHOD_PUREANA1, NextPropertyValueId = 125, PrevPropertyValueId = 121 });
            this.FilterPropertyValues.Add(125, new FilterPropertyValueEnum { Id = 125, Supported = true, Enabled = true, Name = "TrueAnaBR", Value = CONSTS.METHOD_PUREANA2, NextPropertyValueId = 126, PrevPropertyValueId = 124 });
            this.FilterPropertyValues.Add(126, new FilterPropertyValueEnum { Id = 126, Supported = true, Enabled = true, Name = "TrueAnaRG", Value = CONSTS.METHOD_PUREANA3, NextPropertyValueId = 127, PrevPropertyValueId = 125 });
            this.FilterPropertyValues.Add(127, new FilterPropertyValueEnum { Id = 127, Supported = true, Enabled = true, Name = "TrueAnaGR", Value = CONSTS.METHOD_PUREANA4, NextPropertyValueId = 128, PrevPropertyValueId = 126 });
            this.FilterPropertyValues.Add(128, new FilterPropertyValueEnum { Id = 128, Supported = true, Enabled = true, Name = "GrayAnaRC", Value = CONSTS.METHOD_GREYANA1, NextPropertyValueId = 129, PrevPropertyValueId = 127 });
            this.FilterPropertyValues.Add(129, new FilterPropertyValueEnum { Id = 129, Supported = true, Enabled = true, Name = "GrayAnaCR", Value = CONSTS.METHOD_GREYANA2, NextPropertyValueId = 130, PrevPropertyValueId = 128 });
            this.FilterPropertyValues.Add(130, new FilterPropertyValueEnum { Id = 130, Supported = true, Enabled = true, Name = "GrayAnaYB", Value = CONSTS.METHOD_GREYANA3, NextPropertyValueId = 131, PrevPropertyValueId = 129 });
            this.FilterPropertyValues.Add(131, new FilterPropertyValueEnum { Id = 131, Supported = true, Enabled = true, Name = "GrayAnaBY", Value = CONSTS.METHOD_GREYANA4, NextPropertyValueId = 132, PrevPropertyValueId = 130 });
            this.FilterPropertyValues.Add(132, new FilterPropertyValueEnum { Id = 132, Supported = true, Enabled = true, Name = "GrayAnaGP", Value = CONSTS.METHOD_GREYANA5, NextPropertyValueId = 133, PrevPropertyValueId = 131 });
            this.FilterPropertyValues.Add(133, new FilterPropertyValueEnum { Id = 133, Supported = true, Enabled = true, Name = "GrayAnaPG", Value = CONSTS.METHOD_GREYANA6, NextPropertyValueId = 134, PrevPropertyValueId = 132 });
            this.FilterPropertyValues.Add(134, new FilterPropertyValueEnum { Id = 134, Supported = true, Enabled = true, Name = "HColAnaRC", Value = CONSTS.METHOD_SHADEANA1, NextPropertyValueId = 135, PrevPropertyValueId = 133 });
            this.FilterPropertyValues.Add(135, new FilterPropertyValueEnum { Id = 135, Supported = true, Enabled = true, Name = "HColAnaCR", Value = CONSTS.METHOD_SHADEANA2, NextPropertyValueId = 136, PrevPropertyValueId = 134 });
            this.FilterPropertyValues.Add(136, new FilterPropertyValueEnum { Id = 136, Supported = true, Enabled = true, Name = "HColAnaYB", Value = CONSTS.METHOD_SHADEANA3, NextPropertyValueId = 137, PrevPropertyValueId = 135 });
            this.FilterPropertyValues.Add(137, new FilterPropertyValueEnum { Id = 137, Supported = true, Enabled = true, Name = "HColAnaBY", Value = CONSTS.METHOD_SHADEANA4, NextPropertyValueId = 138, PrevPropertyValueId = 136 });
            this.FilterPropertyValues.Add(138, new FilterPropertyValueEnum { Id = 138, Supported = true, Enabled = true, Name = "HColAnaGP", Value = CONSTS.METHOD_SHADEANA5, NextPropertyValueId = 139, PrevPropertyValueId = 137 });
            this.FilterPropertyValues.Add(139, new FilterPropertyValueEnum { Id = 139, Supported = true, Enabled = true, Name = "HColAnaPG", Value = CONSTS.METHOD_SHADEANA6, NextPropertyValueId = 140, PrevPropertyValueId = 138 });
            this.FilterPropertyValues.Add(140, new FilterPropertyValueEnum { Id = 140, Supported = true, Enabled = true, Name = "ColAnaRC", Value = CONSTS.METHOD_COLORANA1, NextPropertyValueId = 141, PrevPropertyValueId = 139 });
            this.FilterPropertyValues.Add(141, new FilterPropertyValueEnum { Id = 141, Supported = true, Enabled = true, Name = "ColAnaCR", Value = CONSTS.METHOD_COLORANA2, NextPropertyValueId = 142, PrevPropertyValueId = 140 });
            this.FilterPropertyValues.Add(142, new FilterPropertyValueEnum { Id = 142, Supported = true, Enabled = true, Name = "ColAnaYB", Value = CONSTS.METHOD_COLORANA3, NextPropertyValueId = 143, PrevPropertyValueId = 141 });
            this.FilterPropertyValues.Add(143, new FilterPropertyValueEnum { Id = 143, Supported = true, Enabled = true, Name = "ColAnaBY", Value = CONSTS.METHOD_COLORANA4, NextPropertyValueId = 144, PrevPropertyValueId = 142 });
            this.FilterPropertyValues.Add(144, new FilterPropertyValueEnum { Id = 144, Supported = true, Enabled = true, Name = "ColAnaGP", Value = CONSTS.METHOD_COLORANA5, NextPropertyValueId = 145, PrevPropertyValueId = 143 });
            this.FilterPropertyValues.Add(145, new FilterPropertyValueEnum { Id = 145, Supported = true, Enabled = true, Name = "ColAnaPG", Value = CONSTS.METHOD_COLORANA6, NextPropertyValueId = 146, PrevPropertyValueId = 144 });
            this.FilterPropertyValues.Add(146, new FilterPropertyValueEnum { Id = 146, Supported = true, Enabled = true, Name = "OptAnaRC", Value = CONSTS.METHOD_OPTANA1, NextPropertyValueId = 147, PrevPropertyValueId = 145 });
            this.FilterPropertyValues.Add(147, new FilterPropertyValueEnum { Id = 147, Supported = true, Enabled = true, Name = "OptAnaCR", Value = CONSTS.METHOD_OPTANA2, NextPropertyValueId = 148, PrevPropertyValueId = 146 });
            this.FilterPropertyValues.Add(148, new FilterPropertyValueEnum { Id = 148, Supported = true, Enabled = true, Name = "OptAnaYB", Value = CONSTS.METHOD_OPTANA3, NextPropertyValueId = 149, PrevPropertyValueId = 147 });
            this.FilterPropertyValues.Add(149, new FilterPropertyValueEnum { Id = 149, Supported = true, Enabled = true, Name = "OptAnaBY", Value = CONSTS.METHOD_OPTANA4, NextPropertyValueId = 150, PrevPropertyValueId = 148 });
            this.FilterPropertyValues.Add(150, new FilterPropertyValueEnum { Id = 150, Supported = true, Enabled = true, Name = "OptAnaGP", Value = CONSTS.METHOD_OPTANA5, NextPropertyValueId = 151, PrevPropertyValueId = 149 });
            this.FilterPropertyValues.Add(151, new FilterPropertyValueEnum { Id = 151, Supported = true, Enabled = true, Name = "OptAnaPG", Value = CONSTS.METHOD_OPTANA6, NextPropertyValueId = 101, PrevPropertyValueId = 150 });
            this.FilterPropertyValues.Add(152, new FilterPropertyValueEnum { Id = 152, Supported = true, Enabled = true, Name = "StereoBrightL", Value = CONSTS.METHOD_STEREOBRIGHTLEFT, NextPropertyValueId = 153, PrevPropertyValueId = 103 });
#if SPECIAL && NVIDIA
            this.FilterPropertyValue.Add(153, new FilterPropertyValueEnum { Id = 153, Supported = true, Enabled = true, Name = "StereoBrightR", Value = CONSTS.METHOD_STEREOBRIGHTRIGHT, NextPropertyValueId = 106, PrevPropertyValueId = 152 });
#else
#if SPECIAL && DUALOUTPUT
            this.FilterPropertyValue.Add(153, new FilterPropertyValueEnum { Id = 153, Supported = true, Enabled = true, Name = "StereoBrightR", Value = CONSTS.METHOD_STEREOBRIGHTRIGHT, NextPropertyValueId = 104, PrevPropertyValueId = 152 });
#else
            this.FilterPropertyValues.Add(153, new FilterPropertyValueEnum { Id = 153, Supported = true, Enabled = true, Name = "StereoBrightR", Value = CONSTS.METHOD_STEREOBRIGHTRIGHT, NextPropertyValueId = 114, PrevPropertyValueId = 152 });
#endif
#endif
            this.FilterPropertyValues.Add(154, new FilterPropertyValueEnum { Id = 154, Supported = false, Enabled = false, Name = "DirectXDual", Value = CONSTS.METHOD_DXDUALSCREEN });
        }

        /// <summary>
        /// The initialize menu commands.
        /// </summary>
        private void InitializeMenuCommands()
        {
            // Common commands
            this.MenuCommands.Add(1, new MenuCommand { Id = 1, Name = "Back", Enabled = true, CommandType = MenuCommand.MenuCommandType.PrevMenu });
            this.MenuCommands.Add(2, new MenuCommand { Id = 2, Name = "Mode3D", Enabled = true, CommandType = MenuCommand.MenuCommandType.SetMode3D, HotKey = System.Windows.Forms.Keys.D3 });
            this.MenuCommands.Add(3, new MenuCommand { Id = 3, Name = "Mode3D", Enabled = true, CommandType = MenuCommand.MenuCommandType.SetMode3D, HotKey = System.Windows.Forms.Keys.NumPad3 });
            this.MenuCommands.Add(4, new MenuCommand { Id = 4, Name = "Mode3D", Enabled = true, CommandType = MenuCommand.MenuCommandType.SetMode3D });
            this.MenuCommands.Add(5, new MenuCommandGoTo { Id = 5, Name = "Mode3DContextMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, HotKey = System.Windows.Forms.Keys.F9, HotKeyMode3DDependent = true, MenuId = 1 });

            // Context menu commands
            this.MenuCommands.Add(101, new MenuCommandGoTo { Id = 101, Name = "SelectSourceFormat", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 2 });
            this.MenuCommands.Add(102, new MenuCommandGoTo { Id = 102, Name = "SelectOutputFormat", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 3 });
            this.MenuCommands.Add(103, new MenuCommandGoTo { Id = 103, Name = "AdjustParallax", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 4 });
            this.MenuCommands.Add(104, new MenuCommand { Id = 104, Name = "UpdateProfile", Enabled = true, CommandType = MenuCommand.MenuCommandType.UpdateProfile });
            this.MenuCommands.Add(105, new MenuCommand { Id = 105, Name = "UpdateSubtitles", Enabled = true, CommandType = MenuCommand.MenuCommandType.UpdateSubtitles });
            this.MenuCommands.Add(106, new MenuCommand { Id = 106, Name = "DetectLetterbox", Enabled = true, CommandType = MenuCommand.MenuCommandType.DetectLetterbox });
            this.MenuCommands.Add(107, new MenuCommand { Id = 107, Name = "StereoscopicMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.StereoscopicMenu });

            // Select source format commands
            this.MenuCommands.Add(201, new MenuCommandPropertySet { Id = 201, Name = "Monoscopic", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 101 });
            this.MenuCommands.Add(202, new MenuCommandGoTo { Id = 202, Name = "Interlaced", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 5 });
            this.MenuCommands.Add(203, new MenuCommandGoTo { Id = 203, Name = "SideBySide", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 6 });
            this.MenuCommands.Add(204, new MenuCommandGoTo { Id = 204, Name = "OverUnder", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 7 });
            this.MenuCommands.Add(205, new MenuCommandGoTo { Id = 205, Name = "MultiViewTiled", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 8 });
            this.MenuCommands.Add(206, new MenuCommandGoTo { Id = 206, Name = "FrameSequential", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 9 });

            // Select output format commands
            this.MenuCommands.Add(301, new MenuCommandGoTo { Id = 301, Name = "Output2D", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 10 });
            this.MenuCommands.Add(302, new MenuCommandGoTo { Id = 302, Name = "SideBySide", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 11 });
            this.MenuCommands.Add(303, new MenuCommandGoTo { Id = 303, Name = "OverUnder", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 12 });
            this.MenuCommands.Add(304, new MenuCommandGoTo { Id = 304, Name = "RowInterlaced", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 13 });
            this.MenuCommands.Add(305, new MenuCommandGoTo { Id = 305, Name = "ColumnInterlaced", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 14 });
            this.MenuCommands.Add(306, new MenuCommandGoTo { Id = 306, Name = "TrueAna", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 15 });
            this.MenuCommands.Add(307, new MenuCommandGoTo { Id = 307, Name = "GrayAna", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 16 });
            this.MenuCommands.Add(308, new MenuCommandGoTo { Id = 308, Name = "HColAna", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 17 });
            this.MenuCommands.Add(309, new MenuCommandGoTo { Id = 309, Name = "ColAna", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 18 });
            this.MenuCommands.Add(310, new MenuCommandGoTo { Id = 310, Name = "OptAna", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 19 });
            this.MenuCommands.Add(311, new MenuCommandGoTo { Id = 311, Name = "StereoBright", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 20 });
#if SPECIAL
            this.MenuCommands.Add(312, new MenuCommandGoTo { Id = 312, Name = "Special", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 24 });
#endif

            // Adjust parallax commands
            this.MenuCommands.Add(401, new MenuCommandPropertyCycle { Id = 401, Name = "IncreaseHorizontal", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyIncrease, Step = MenuCommandPropertyCycle.CycleStep.ParallaxStep, PropertyId = 3 });
            this.MenuCommands.Add(402, new MenuCommandPropertyCycle { Id = 402, Name = "DecreaseHorizontal", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyDecrease, Step = MenuCommandPropertyCycle.CycleStep.ParallaxStep, PropertyId = 3 });
            this.MenuCommands.Add(403, new MenuCommandPropertyCycle { Id = 403, Name = "IncreaseVertical", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyIncrease, Step = MenuCommandPropertyCycle.CycleStep.ParallaxStep, PropertyId = 4 });
            this.MenuCommands.Add(404, new MenuCommandPropertyCycle { Id = 404, Name = "DecreaseVertical", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyDecrease, Step = MenuCommandPropertyCycle.CycleStep.ParallaxStep, PropertyId = 4 });

            // Select interlace source format commands
            this.MenuCommands.Add(501, new MenuCommandPropertySet { Id = 501, Name = "RF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 2 });
            this.MenuCommands.Add(502, new MenuCommandPropertySet { Id = 502, Name = "LF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 3 });

            // Select side by side source format commands
            this.MenuCommands.Add(601, new MenuCommandPropertySet { Id = 601, Name = "RF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 4 });
            this.MenuCommands.Add(602, new MenuCommandPropertySet { Id = 602, Name = "LF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 5 });

            // Select over under source format commands
            this.MenuCommands.Add(701, new MenuCommandPropertySet { Id = 701, Name = "RT", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 6 });
            this.MenuCommands.Add(702, new MenuCommandPropertySet { Id = 702, Name = "LT", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 7 });

            // Select multiview tiled source format commands
            this.MenuCommands.Add(801, new MenuCommandPropertySet { Id = 801, Name = "Normal", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 11 });
            this.MenuCommands.Add(802, new MenuCommandPropertySet { Id = 802, Name = "Reversed", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 12 });

            // Select frame sequential source format commands
            this.MenuCommands.Add(901, new MenuCommandPropertySet { Id = 901, Name = "RF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 13 });
            this.MenuCommands.Add(902, new MenuCommandPropertySet { Id = 902, Name = "LF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 1, Value = 14 });

            // Select 2D output format commands
            this.MenuCommands.Add(1001, new MenuCommandPropertySet { Id = 1001, Name = "L", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 102 });
            this.MenuCommands.Add(1002, new MenuCommandPropertySet { Id = 1002, Name = "R", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 103 });

            // Select side by side output format commands
            this.MenuCommands.Add(1101, new MenuCommandPropertySet { Id = 1101, Name = "RF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 114 });
            this.MenuCommands.Add(1102, new MenuCommandPropertySet { Id = 1102, Name = "LF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 115 });

            // Select over under output format commands
            this.MenuCommands.Add(1201, new MenuCommandPropertySet { Id = 1201, Name = "RT", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 116 });
            this.MenuCommands.Add(1202, new MenuCommandPropertySet { Id = 1202, Name = "LT", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 117 });

            // Select row interlaced output format commands
            this.MenuCommands.Add(1301, new MenuCommandPropertySet { Id = 1301, Name = "RT", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 118 });
            this.MenuCommands.Add(1302, new MenuCommandPropertySet { Id = 1302, Name = "LT", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 119 });

            // Select column interlaced output format commands
            this.MenuCommands.Add(1401, new MenuCommandPropertySet { Id = 1401, Name = "RF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 120 });
            this.MenuCommands.Add(1402, new MenuCommandPropertySet { Id = 1402, Name = "LF", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 121 });

            // Select true anaglyph output format commands
            this.MenuCommands.Add(1501, new MenuCommandPropertySet { Id = 1501, Name = "RB", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 124 });
            this.MenuCommands.Add(1502, new MenuCommandPropertySet { Id = 1502, Name = "BR", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 125 });
            this.MenuCommands.Add(1503, new MenuCommandPropertySet { Id = 1503, Name = "RG", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 126 });
            this.MenuCommands.Add(1504, new MenuCommandPropertySet { Id = 1504, Name = "GR", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 127 });

            // Select gray anaglyph output format commands
            this.MenuCommands.Add(1601, new MenuCommandPropertySet { Id = 1601, Name = "RC", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 128 });
            this.MenuCommands.Add(1602, new MenuCommandPropertySet { Id = 1602, Name = "CR", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 129 });
            this.MenuCommands.Add(1603, new MenuCommandPropertySet { Id = 1603, Name = "YB", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 130 });
            this.MenuCommands.Add(1604, new MenuCommandPropertySet { Id = 1604, Name = "BY", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 131 });
            this.MenuCommands.Add(1605, new MenuCommandPropertySet { Id = 1605, Name = "GP", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 132 });
            this.MenuCommands.Add(1606, new MenuCommandPropertySet { Id = 1606, Name = "PG", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 133 });

            // Select half color anaglyph output format commands
            this.MenuCommands.Add(1701, new MenuCommandPropertySet { Id = 1701, Name = "RC", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 134 });
            this.MenuCommands.Add(1702, new MenuCommandPropertySet { Id = 1702, Name = "CR", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 135 });
            this.MenuCommands.Add(1703, new MenuCommandPropertySet { Id = 1703, Name = "YB", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 136 });
            this.MenuCommands.Add(1704, new MenuCommandPropertySet { Id = 1704, Name = "BY", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 137 });
            this.MenuCommands.Add(1705, new MenuCommandPropertySet { Id = 1705, Name = "GP", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 138 });
            this.MenuCommands.Add(1706, new MenuCommandPropertySet { Id = 1706, Name = "PG", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 139 });

            // Select color anaglyph output format commands
            this.MenuCommands.Add(1801, new MenuCommandPropertySet { Id = 1801, Name = "RC", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 140 });
            this.MenuCommands.Add(1802, new MenuCommandPropertySet { Id = 1802, Name = "CR", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 141 });
            this.MenuCommands.Add(1803, new MenuCommandPropertySet { Id = 1803, Name = "YB", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 142 });
            this.MenuCommands.Add(1804, new MenuCommandPropertySet { Id = 1804, Name = "BY", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 143 });
            this.MenuCommands.Add(1805, new MenuCommandPropertySet { Id = 1805, Name = "GP", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 144 });
            this.MenuCommands.Add(1806, new MenuCommandPropertySet { Id = 1806, Name = "PG", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 145 });

            // Select optical anaglyph output format commands
            this.MenuCommands.Add(1901, new MenuCommandPropertySet { Id = 1901, Name = "RC", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 146 });
            this.MenuCommands.Add(1902, new MenuCommandPropertySet { Id = 1902, Name = "CR", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 147 });
            this.MenuCommands.Add(1903, new MenuCommandPropertySet { Id = 1903, Name = "YB", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 148 });
            this.MenuCommands.Add(1904, new MenuCommandPropertySet { Id = 1904, Name = "BY", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 149 });
            this.MenuCommands.Add(1905, new MenuCommandPropertySet { Id = 1905, Name = "GP", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 150 });
            this.MenuCommands.Add(1906, new MenuCommandPropertySet { Id = 1906, Name = "PG", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 151 });

            // Select StereoBright output format commands
            this.MenuCommands.Add(2001, new MenuCommandPropertySet { Id = 2001, Name = "L", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 152 });
            this.MenuCommands.Add(2002, new MenuCommandPropertySet { Id = 2002, Name = "R", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 153 });

            // Quick menu - Source format commands
            this.MenuCommands.Add(2101, new MenuCommandGoTo { Id = 2101, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 22, HotKey = System.Windows.Forms.Keys.D0 });
            this.MenuCommands.Add(2102, new MenuCommandGoTo { Id = 2102, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 22, HotKey = System.Windows.Forms.Keys.NumPad0 });
            this.MenuCommands.Add(2103, new MenuCommandGoTo { Id = 2103, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 22 });
            this.MenuCommands.Add(2104, new MenuCommandPropertyCycle { Id = 2104, Name = "DecreaseSourceFormat", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyDecrease, PropertyId = 1, HotKey = Keys.Left });
            this.MenuCommands.Add(2105, new MenuCommandPropertyCycle { Id = 2105, Name = "IncreaseSourceFormat", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyIncrease, PropertyId = 1, HotKey = Keys.Right });

            // Quick menu - Output format commands
            this.MenuCommands.Add(2201, new MenuCommandGoTo { Id = 2201, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 23, HotKey = System.Windows.Forms.Keys.D0 });
            this.MenuCommands.Add(2202, new MenuCommandGoTo { Id = 2202, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 23, HotKey = System.Windows.Forms.Keys.NumPad0 });
            this.MenuCommands.Add(2203, new MenuCommandGoTo { Id = 2203, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 23 });
            this.MenuCommands.Add(2204, new MenuCommandPropertyCycle { Id = 2204, Name = "DecreaseOutputFormat", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyDecrease, PropertyId = 2, HotKey = Keys.Left });
            this.MenuCommands.Add(2205, new MenuCommandPropertyCycle { Id = 2205, Name = "IncreaseOutputFormat", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyIncrease, PropertyId = 2, HotKey = Keys.Right });

            // Quick menu - Adjust parallax commands
            this.MenuCommands.Add(2301, new MenuCommandGoTo { Id = 2301, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 21, HotKey = System.Windows.Forms.Keys.D0 });
            this.MenuCommands.Add(2302, new MenuCommandGoTo { Id = 2302, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 21, HotKey = System.Windows.Forms.Keys.NumPad0 });
            this.MenuCommands.Add(2303, new MenuCommandGoTo { Id = 2303, Name = "NextQuickMenu", Enabled = true, CommandType = MenuCommand.MenuCommandType.GotoMenu, MenuId = 21 });
            this.MenuCommands.Add(2304, new MenuCommandPropertyCycle { Id = 2304, Name = "DecreaseHorizontalParallax", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyDecrease, PropertyId = 3, Step = MenuCommandPropertyCycle.CycleStep.ParallaxStep, HotKey = Keys.Left });
            this.MenuCommands.Add(2305, new MenuCommandPropertyCycle { Id = 2305, Name = "IncreaseHorizontalParallax", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyIncrease, PropertyId = 3, Step = MenuCommandPropertyCycle.CycleStep.ParallaxStep, HotKey = Keys.Right });
            this.MenuCommands.Add(2306, new MenuCommandPropertyCycle { Id = 2306, Name = "DecreaseVerticalParallax", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyDecrease, PropertyId = 4, Step = MenuCommandPropertyCycle.CycleStep.ParallaxStep, HotKey = Keys.Down });
            this.MenuCommands.Add(2307, new MenuCommandPropertyCycle { Id = 2307, Name = "IncreaseVerticalParallax", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertyIncrease, PropertyId = 4, Step = MenuCommandPropertyCycle.CycleStep.ParallaxStep, HotKey = Keys.Up });

#if SPECIAL
    
    
    
    
    
    // Special menu - NVIDIA etc
#if NVIDIA
            this.MenuCommands.Add(2401, new MenuCommandPropertySet { Id = 2401, Name = "NVIDIA", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 106 });
#else
#if DUALOUTPUT
            this.MenuCommands.Add(2401, new MenuCommandPropertySet { Id = 2401, Name = "Dual", Enabled = true, CommandType = MenuCommand.MenuCommandType.PropertySet, PropertyId = 2, Value = 104 });
#endif
#endif
#endif
        }

        /// <summary>
        /// The initialize menus.
        /// </summary>
        private void InitializeMenus()
        {
            // Context menu
            Collection<int> commandIds = new Collection<int> { 101, 102, 103, 104, 105, 106, 107 };
            this.Menus.Add(1, new Menu { Id = 1, Name = "ContextMenu", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.DialogWithProfiles, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.RememberLast });

            // Select source format menu
            commandIds = new Collection<int> { 1, 201, 202, 203, 204, 205, 206 };
            this.Menus.Add(2, new Menu { Id = 2, Name = "SelectSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select output format menu
#if SPECIAL
            commandIds = new Collection<int> { 1, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312 };
#else
            commandIds = new Collection<int> { 1, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311 };
#endif
            this.Menus.Add(3, new Menu { Id = 3, Name = "SelectOutputFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Adjust parallax menu
            commandIds = new Collection<int> { 1, 401, 402, 403, 404 };
            this.Menus.Add(4, new Menu { Id = 4, Name = "AdjustParallax", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.RememberLast });

            // Select interlaced source format menu
            commandIds = new Collection<int> { 1, 501, 502 };
            this.Menus.Add(5, new Menu { Id = 5, Name = "InterlacedSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select side by side source format menu
            commandIds = new Collection<int> { 1, 601, 602 };
            this.Menus.Add(6, new Menu { Id = 6, Name = "SideBySideSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select over under source format menu
            commandIds = new Collection<int> { 1, 701, 702 };
            this.Menus.Add(7, new Menu { Id = 7, Name = "OverUnderSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select multiview tiled source format menu
            commandIds = new Collection<int> { 1, 801, 802 };
            this.Menus.Add(8, new Menu { Id = 8, Name = "MultiViewTiledSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select frame sequential source format menu
            commandIds = new Collection<int> { 1, 901, 902 };
            this.Menus.Add(9, new Menu { Id = 9, Name = "FrameSequentialSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select 2D output format menu
            commandIds = new Collection<int> { 1, 1001, 1002 };
            this.Menus.Add(10, new Menu { Id = 10, Name = "Output2DSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select side by side output format menu
            commandIds = new Collection<int> { 1, 1101, 1102 };
            this.Menus.Add(11, new Menu { Id = 11, Name = "SideBySideSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select over under output format menu
            commandIds = new Collection<int> { 1, 1201, 1202 };
            this.Menus.Add(12, new Menu { Id = 12, Name = "OverUnderSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select row interlaced output format menu
            commandIds = new Collection<int> { 1, 1301, 1302 };
            this.Menus.Add(13, new Menu { Id = 13, Name = "RowInterlacedSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select column interlaced output format menu
            commandIds = new Collection<int> { 1, 1401, 1402 };
            this.Menus.Add(14, new Menu { Id = 14, Name = "ColumnInterlacedSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select true anaglyph output format menu
            commandIds = new Collection<int> { 1, 1501, 1502, 1503, 1504 };
            this.Menus.Add(15, new Menu { Id = 15, Name = "TrueAnaSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select gray anaglyph output format menu
            commandIds = new Collection<int> { 1, 1601, 1602, 1603, 1604, 1605, 1606 };
            this.Menus.Add(16, new Menu { Id = 16, Name = "GrayAnaSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select half color anaglyph output format menu
            commandIds = new Collection<int> { 1, 1701, 1702, 1703, 1704, 1705, 1706 };
            this.Menus.Add(17, new Menu { Id = 17, Name = "HColAnaSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select color anaglyph output format menu
            commandIds = new Collection<int> { 1, 1801, 1802, 1803, 1804, 1805, 1806 };
            this.Menus.Add(18, new Menu { Id = 18, Name = "ColAnaSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select optimized anaglyph output format menu
            commandIds = new Collection<int> { 1, 1901, 1902, 1903, 1904, 1905, 1906 };
            this.Menus.Add(19, new Menu { Id = 19, Name = "OptAnaSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Select stereobright output format menu
            commandIds = new Collection<int> { 1, 2001, 2002 };
            this.Menus.Add(20, new Menu { Id = 20, Name = "StereoBrightSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });

            // Quick Menu - Source format
            commandIds = new Collection<int> { 2101, 2102, 2103, 2104, 2105 };
            this.Menus.Add(21, new Menu { Id = 21, Name = "QuickMenuSourceFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Osd, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.RememberLast });

            // Quick Menu - Output format
            commandIds = new Collection<int> { 2201, 2202, 2203, 2204, 2205 };
            this.Menus.Add(22, new Menu { Id = 22, Name = "QuickMenuOutputFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Osd, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.RememberLast });

            // Quick Menu - Adjust parallax
            commandIds = new Collection<int> { 2301, 2302, 2303, 2304, 2305, 2306, 2307 };
            this.Menus.Add(23, new Menu { Id = 23, Name = "QuickMenuAdjustParallax", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Osd, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.RememberLast });

#if SPECIAL
    
    
    // Select special output format menu
            commandIds = new Collection<int> { 2401 };
            this.Menus.Add(24, new Menu { Id = 24, Name = "SpecialOutputFormat", MenuCommandIds = commandIds, MenuType = Menu.MenuTypes.Dialog, AfterCommandAction = Menu.MenuAfterCommandActions.Hide, InitialOptionType = Menu.MenuInitialOptionTypes.FromFilterProperty });
#endif
        }

        /// <summary>
        /// The initialize profiles.
        /// </summary>
        private void InitializeProfiles()
        {
            Profile profile = new Profile { Id = 1, Name = "Default", Enabled = true };
            this.Profiles.Add(1, profile);

            // SourceFormat
            profile.ProfileProperties.Add(1, new ProfilePropertyPerSource { PropertyId = 1, DefaultValue = TSTFConfig.LAYOUT_MONOSCOPIC, PropertyType = ProfileProperty.ProfilePropertyType.SavePerSource });

            // OutputFormat
            profile.ProfileProperties.Add(2, new ProfileProperty { PropertyId = 2, DefaultValue = CONSTS.METHOD_SOURCE, PropertyType = ProfileProperty.ProfilePropertyType.SaveGlobally });

            // Horizontal Parallax
            profile.ProfileProperties.Add(3, new ProfilePropertyPerSource { PropertyId = 3, DefaultValue = 0, PropertyType = ProfileProperty.ProfilePropertyType.SavePerSource });

            // Vertical Parallax
            profile.ProfileProperties.Add(4, new ProfilePropertyPerSource { PropertyId = 4, DefaultValue = 0, PropertyType = ProfileProperty.ProfilePropertyType.SavePerSource });
        }

        #endregion
    }
}